<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/5/11
 * Time: 12:28
 */
header('Content-Type:application/json');
include 'classes/conn.php';
$query1="select num,name,teacher from class";
$query2="select num,name from teacher";
$classes=array();
$teachers=array();
$res=mysql_query($query1);
while ($row=mysql_fetch_assoc($res)){
    $classes[]=$row;
}
$res=mysql_query($query2);
while ($row=mysql_fetch_assoc($res)){
    $teachers[]=$row;
}
$classes=array('classes'=>$classes);
$teachers=array('teachers'=>$teachers);
$data=array_merge($teachers,$classes);
$data=json_encode($data);
echo $data;
